
package com.shop.cloud.upms.admin.controller;

import com.shop.cloud.common.core.util.R;
import com.shop.cloud.common.log.annotation.SysLog;
import com.shop.cloud.upms.common.entity.SysTenantPackageMenu;
import com.shop.cloud.upms.admin.service.SysTenantPackageMenuService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

/**
 * 租户套餐菜单
 *
 * @author
 * @date 2023-12-25 14:37:02
 */
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/tenantpackagemenu")
@Tag(description = "tenantpackagemenu", name = "租户套餐菜单管理")
public class SysTenantPackageMenuController {

    private final SysTenantPackageMenuService sysTenantPackageMenuService;


    /**
     * 租户套餐菜单查询
     * @param id
     * @return R
     */
    @Operation(summary = "租户套餐菜单查询")
    @GetMapping("/{id}")
    @PreAuthorize("@ato.hasAuthority('upms:tenantpackagemenu:get')")
    public R getById(@PathVariable("id") String id) {
        return R.ok(sysTenantPackageMenuService.getById(id));
    }

    /**
     * 租户套餐菜单修改
     * @param sysTenantPackageMenu 租户套餐菜单
     * @return R
     */
    @Operation(summary = "租户套餐菜单修改")
    @SysLog("修改租户套餐菜单")
    @PutMapping
    @PreAuthorize("@ato.hasAuthority('upms:tenantpackagemenu:edit')")
    public R updateById(@RequestBody SysTenantPackageMenu sysTenantPackageMenu) {
        return R.ok(sysTenantPackageMenuService.updateById(sysTenantPackageMenu));
    }

}
